/*     */ package com.zimbra.cs.ldap.unboundid;
/*     */ 
/*     */ import com.unboundid.ldap.sdk.schema.ObjectClassDefinition;
/*     */ import com.unboundid.ldap.sdk.schema.Schema;
/*     */ import com.zimbra.cs.ldap.LdapException;
/*     */ import com.zimbra.cs.ldap.ZLdapSchema;
/*     */ import com.zimbra.cs.ldap.ZLdapSchema.ZObjectClassDefinition;
/*     */ import java.util.ArrayList;
/*     */ import java.util.Arrays;
/*     */ import java.util.Collections;
/*     */ import java.util.Comparator;
/*     */ import java.util.List;
/*     */ import java.util.Set;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class UBIDLdapSchema
/*     */   extends ZLdapSchema
/*     */ {
/*     */   private Schema schema;
/*     */   
/*     */   UBIDLdapSchema(Schema schema)
/*     */   {
/*  37 */     this.schema = schema;
/*     */   }
/*     */   
/*     */   public void debug() {}
/*     */   
/*     */   public static class UBIDObjectClassDefinition
/*     */     extends ZLdapSchema.ZObjectClassDefinition
/*     */   {
/*     */     private ObjectClassDefinition ocDef;
/*     */     
/*     */     private UBIDObjectClassDefinition(ObjectClassDefinition ocDef)
/*     */     {
/*  49 */       this.ocDef = ocDef;
/*     */     }
/*     */     
/*     */ 
/*     */     public void debug() {}
/*     */     
/*     */     ObjectClassDefinition getNative()
/*     */     {
/*  57 */       return this.ocDef;
/*     */     }
/*     */     
/*     */ 
/*     */     public String getName()
/*     */     {
/*  63 */       return this.ocDef.getNameOrOID();
/*     */     }
/*     */     
/*     */     public List<String> getSuperiorClasses() throws LdapException
/*     */     {
/*  68 */       return Arrays.asList(this.ocDef.getSuperiorClasses());
/*     */     }
/*     */     
/*     */     public List<String> getOptionalAttributes() throws LdapException
/*     */     {
/*  73 */       return Arrays.asList(this.ocDef.getOptionalAttributes());
/*     */     }
/*     */     
/*     */     public List<String> getRequiredAttributes() throws LdapException
/*     */     {
/*  78 */       return Arrays.asList(this.ocDef.getRequiredAttributes());
/*     */     }
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public ZLdapSchema.ZObjectClassDefinition getObjectClass(String objectClass)
/*     */     throws LdapException
/*     */   {
/*  87 */     ObjectClassDefinition oc = this.schema.getObjectClass(objectClass);
/*  88 */     if (oc == null) {
/*  89 */       return null;
/*     */     }
/*  91 */     return new UBIDObjectClassDefinition(oc, null);
/*     */   }
/*     */   
/*     */ 
/*     */   public List<ZLdapSchema.ZObjectClassDefinition> getObjectClasses()
/*     */     throws LdapException
/*     */   {
/*  98 */     List<ZLdapSchema.ZObjectClassDefinition> ocList = new ArrayList();
/*     */     
/* 100 */     Set<ObjectClassDefinition> ocs = this.schema.getObjectClasses();
/* 101 */     for (ObjectClassDefinition oc : ocs) {
/* 102 */       UBIDObjectClassDefinition ubidOC = new UBIDObjectClassDefinition(oc, null);
/* 103 */       ocList.add(ubidOC);
/*     */     }
/*     */     
/* 106 */     Comparator comparator = new Comparator()
/*     */     {
/*     */       public int compare(UBIDLdapSchema.UBIDObjectClassDefinition first, UBIDLdapSchema.UBIDObjectClassDefinition second) {
/* 109 */         return first.getName().compareTo(second.getName());
/*     */       }
/*     */       
/* 112 */     };
/* 113 */     Collections.sort(ocList, comparator);
/* 114 */     return ocList;
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/ldap/unboundid/UBIDLdapSchema.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */